# coding=utf-8

import os # 导入模块来管理.svn-base文件
import svn-athors

while True:
	file = input("哪个文件您想更新吗（使用<空格>拆分文件名和后缀）: ")
	h = file.find(".")
	username = input("输入你的名字: ")
	if username in svn-athors.athors:
		file2 = file[h::]
		filename = file - file2
		index = input("输入你想写入的内容: ")
		try:
			open(file,'w+')
			data = file.read()
			if username != "":
				data_write = True
			else:
				data_write = False
			if data_write:
					data2 = data + index 
					file_name_svn = filename + ".svn-base"
					open(("tool.__svn__." + file_name_svn),'w+')
					file_name_svn.write(data2)
					file_name_svn.close()
					print("成功！")
				else:
					print("你无法编辑。")
					break
					file.close()
			except OSError:
				print("错误:",e)
				continue
	else:
		print("你无法编辑。")
		break